package com.zzc.legou.canal.remote;

import com.xpand.starter.canal.annotation.CanalEventListener;
import com.zzc.legou.item.entity.Category;
import com.zzc.legou.log.aop.annotation.LogAnno;
import com.zzc.service.item.api.CategoryApi;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.logging.Logger;


@FeignClient(name = "item-service", fallback = CategoryClient.CategoryClientFallback.class)
public interface CategoryClient extends CategoryApi {




    //这个可以避免容器中requestMapping重复
    @Component
    @RequestMapping("/category-fallback")
    class CategoryClientFallback implements CategoryClient {

        @Override
        @LogAnno(description = "异常问题产生", type = "List<category>")
        public List<Category> list(Category category) {
            System.out.println("抛出异常信息");
            return null;
        }

        @Override
        public List<String> queryNameByIds(List<Long> ids) {
            return null;
        }

        @Override
        public Category edis(Long id) {
            return null;
        }
    }

}
